<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>流程控制</title>
</head>
<body>
<script>
  //2.分支结构
 /* let username = '';
  if(!username){
      alert('用户名不能为空');
  }else{
      alert('欢迎' + username + '回归!');
  }*/
  let names = ['小明','小红','小刚'];
  for (var i = 0; i < names.length; i++) {
      console.log(names[i]);

  }
  //如果用var定义变量，则i在循环结束后仍然存在

  console.log(i);


  //增强for循环

/*  for(let n of names){
      console.log(n);
  }*/
</script>

</body>
</html>